package com.stray.crawl;

import com.stray.crawl.worker.HttpEnums.HttpHeaderValue;


public interface Constants {

	boolean DEBUG = true;

	public interface DefaultSetting {

		String USER_AGENT = UserAgentString.IE_9;
		String CHARSET = "utf-8";
		String ACCEPT_LANGUAGE = "zh-tw,en" + HttpHeaderValue.ACCEPT_LANGUAGE_SUFFIX; // de,es,it,fr,

		int MAX_PENDING = Integer.MAX_VALUE;
		int MAX_CONCURRENT = 10;
		int MAX_PER_ROUTE = 2;

		int CONNECTION_LIVE_TIME = 2; // In min
		int CONNECTION_TIMEOUT = 120 * 1000;

		int HISTORY_RECORD_COUNT = 200;

		String DB_URL = "jdbc:sqlite:storage/db/crawl.sqlite";
		String ROOT_PATH = "./storage";

	}

	public interface HttpCtxKey {

		String REQUEST_SUMMARY = "request-summary";
		String REQUEST_HEADERS = "request-headers";
		String RESPONSE_SUMMARY = "response-summary";
		String RESPONSE_HEADERS = "response-headers";

	}

	public interface PlanKey {

		String REQUEST_METHOD = "plan.request_method";
		String REQUEST_AGENT = "plan.request_agent";
		String CONNECTION_TIMEOUT = "plan.connection_timeout";
		String ENABLE_REFERER = "plan.enable_referer";
		String ENABLE_CACHE = "plan.enable_cache";
		String DOCUMENT_CHARSET = "plan.document_charset";

		String PLAN_GROUP_COLUMN_NAME = "group";
		String PLAN_GROUP_GENERIC = "generic";

	}

	public interface PlanCategory {

		// generic category
		String BINARY = "generic-binary";
		String DOCUMENT = "generic-document";
		String DEBUG = "generic-debug";

		// functional category
		String FORUM_THREAD = "forum-thread";
		String FORUM_CONTENT = "forum-content";

	}

	public interface ConfigKey {

		String PAGE_FIRST_QUERY = "task.page.first";
		String PAGE_LAST_QUERY = "task.page.last";
		String STORAGE_PREFIX = "storage.prefix";

	}

	public interface PlanFields {

		String[] FORUM_THREAD_FIELDS = new String[] {
				"id",
				"follow",
				"thumbnail",
				"category",
				"topic",
				"username",
				"date",
				"replyCount",
				"viewCount",
				"rating"
		};

		String[] FORUM_CONTENT_FIELDS = new String[] {
				"username",
				"topic",
				"content",
				"index",
				"date"
		};

	}

	public interface FieldKey {

		String ID = "id";
		String FOLLOW = "follow";

	}

}